package com.kis.dao;

import java.util.ArrayList;
import java.util.List;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.kis.pojo.Clazz;
import com.kis.pojo.Student;

@Repository("studentDao")
public class StudentDao {
	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;

	public void add(Student s) {
		sqlSessionTemplate.insert("insert",s);
	}
	public List<Student> queryStuLikeName(String name){
		List<Student> stus = new ArrayList<Student>();
		stus = sqlSessionTemplate.selectList("queryListStuLikeName",name);
		return stus;
	}
	public Clazz queryAllStudentByClassId(long id){
		return sqlSessionTemplate.selectOne("selectAllStudentByClazzId",id);
	}
	public List<Student> queryClassStudents(long id){
		return sqlSessionTemplate.selectList("selectClassStudents",id);
	}
}
